#ifndef STATION_H
#define STATION_H

#include <QObject>
#include <QTimer>
#include "hj212.h"
#include "jsonhelper.h"
#include "stationmodel.h"
#include "timerthread.h"
#include "flowmeter.h"

using namespace Moolink;
//using namespace stefanfrings;



        class Station : public QObject
        {

        public:
            Station();
            ~Station();

            static void clickDeviceItem(int index);
            static void clickHostItem(int index);
            static void HostSendAuto(int CN,int hostIndex=-1);
            static void deviceSendAuto(int deviceIndex,int funCode);
            //void UpDateStationInfo(QVariantMap newdata);

            static void goUpDate();
            static void recvTimerCallBack(qint64 UtcSec);


            StationModel stationInfo;



        private:
//                void(*m_callbackFunc)(int devIndex,QString devName,QString res);
            static void recvDeviceCallBack(int devIndex,QString devName,QByteArray res,int error);
            static void recvHostCallBack(int hostIndex,QString hostName,QString res,int error);
            static void processRecvDeviceBackMsg(int index,QString dev,QByteArray resData);
            static void processRecvDeviceBackError(int index,QString res,int error);
            static void processRecvHostBackMsg(int index,QString host,QString res);
            static void processRecvTimerBackMsg(qint64 UtcSec);


            static void processRtdSendToHost(qint64 UtcSec);
            static void processMinSendToHost(qint64 UtcSec);
            static void processHourSendToHost(qint64 UtcSec);
            static void processDaySendToHost(qint64 UtcSec);
            static void processNotSendOkToHost(qint64 UtcSec);




//            qint64 currTimeSec=0;
//            qint64 startupTimeSec=0;
//            qint64 rtdTimeSec=0;
//            qint64 minTimeSec=0;

//            qint64 rtdRemainSec=0;
//            qint64 minRemainSec=0;



        signals:
            void response(const QString &s);
            void error(const QString &s);
            void timeout(const QString &s);
        public slots:

        private slots:
            void showRequest(int Index);//,const QString &s);
//            void processError(const QString &s);
//            void processTimeout(const QString &s);
        };

#endif // STATION_H
